package com.nf.action;

import com.nf.entity.Student;
import com.nf.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class StudentAction {
    @Autowired
    private StudentService studentService;

    @RequestMapping("/getAllStudent")
    public String getAllStudent(Model model){
        List<Student> studentList=studentService.getAllStudent();
        model.addAttribute("studentList",studentList);
        return "Student";
    }

    @RequestMapping("/addStudent")
    public String getaddStudent(Model model){
        return "Student";
    }
}
